package com.xi.controller;

import com.xi.pojo.Result;
import com.xi.pojo.Systems;
import com.xi.service.SystemsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/system")
public class SystemsController {

    @Autowired
    private SystemsService systemsService;

    /*
     * 显示系统配置
     * */
    @GetMapping
    public Result getSystem() {
        log.info("获取系统信息");
        Systems systems = systemsService.getSystems();
        return Result.success(systems);
    }

    /*
     * 修改系统设置
     * */
    @PutMapping
    public Result updateSystem(@RequestBody Systems systems) {
        log.info("更新系统信息：{}", systems);
        systemsService.updateSystems(systems);
        return Result.success();
    }
}
